function domain() {
	var domain = window.location.host
	var str = 'https://api.aicebar.com'
	if (domain == 'wap.yklm.com') {
		str = 'https://api.aicebar.com'
	}
	return str
}

function getQueryString() {
	var search = location.search.substring(1).split('&')
	var json = {}
	for (let i = 0; i < search.length; i++) {
		json[search[i].split('=')[0]] = search[i].split('=')[1]
	}
	return json
}

let token = ''
function appSetToken(data) {
	sessionStorage.setItem('appToken', data)
}
function getAppToken() {
	// token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjE1MjgsImV4cCI6MTcwODQzMzg0NiwiaXNzIjoic3VwZXJ4b24ifQ.WtfV-h41R-nG1TpEg6SomXwLXWMoZJs_sAO2iuWpmv8'
	token = sessionStorage.getItem('appToken') || ''
	return token
}



function switchUrl(str, id, order) {
	return new Promise((resolve) => {
		switch (str) {
			case 1:
				window.location.href = '../html/yunshi.html?id=' + id + '&order=' + order + '&apiToken=' + token
				break;
			case 2:
				window.location.href = '../html/caifu.html?id=' + id + '&order=' + order + '&apiToken=' + token
				break;
			case 3:
				window.location.href = '../html/shiye.html?id=' + id + '&order=' + order + '&apiToken=' + token
				break;
			case 4:
				window.location.href = '../html/ganqing.html?id=' + id + '&order=' + order + '&apiToken=' + token
				break;
			case 5:
				window.location.href = '../html/nianyun.html?id=' + id + '&order=' + order + '&apiToken=' + token
				break;
			default:
				window.location.href = 'https://shop.aicebar.com/public/channel/download.html'
		}
		resolve(true)
		return
	})

}

function handleType(str) {
	if (str == 1) { //运势
		document.title = '一生运势'
		document.documentElement.style.setProperty('--var-bg-color', '#BBFFE5  ')
		document.documentElement.style.setProperty('--var-title-color', '#C9F9E8')
		document.documentElement.style.setProperty('--var-btn-color', '#1CC78D')
	} else if (str == 2) { // 财富
		document.title = '财富格局'
		document.documentElement.style.setProperty('--var-bg-color', '#FFE0C2 ')
		document.documentElement.style.setProperty('--var-des-color', '#A37443')
		document.documentElement.style.setProperty('--var-title-color', '#EBD1B7 ')
		document.documentElement.style.setProperty('--var-btn-color', '#A37443')
	} else if (str == 3) { // 事业
		document.title = '事业格局'
		document.documentElement.style.setProperty('--var-bg-color', '#CBE7FE ')
		document.documentElement.style.setProperty('--var-des-color', '#65B2FC ')
		document.documentElement.style.setProperty('--var-title-color', '#CBE7FE')
		document.documentElement.style.setProperty('--var-btn-color', '#0077FA')
	} else if (str == 4) { //情感
		document.title = '情感格局'
		document.documentElement.style.setProperty('--var-bg-color', '#FFECF0')
		document.documentElement.style.setProperty('--var-des-color', '#FFA9AD')
		document.documentElement.style.setProperty('--var-title-color', '#FFCACD')
		document.documentElement.style.setProperty('--var-btn-color', '#F27396')
	} else if (str == 5) { // 年运
		document.title = '2024年运'
		document.documentElement.style.setProperty('--var-bg-color', '#BD99CA')
		document.documentElement.style.setProperty('--var-des-color', '#5C6ED1')
		document.documentElement.style.setProperty('--var-title-color', '#E5EBFF')
		document.documentElement.style.setProperty('--var-btn-color', '#7990F7')
	}
}
